 /**
   * Copyright 2014 Viettel Telecom. All rights reserved.
   * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   */
 package com.viettel.core.bussiness.cms; 
import java.util.List; 

import org.springframework.beans.factory.annotation.Autowired; 

import com.viettel.core.exceptions.BusinessException; 
import com.viettel.core.exceptions.DataAccessException; 
import com.viettel.core.common.utils.KPaging;
import com.viettel.core.dao.cms.ArticleDAO;
import com.viettel.core.entities.cms.Article;
import com.viettel.core.entities.vo.ArticleRegimensSearchVO;
import com.viettel.core.entities.vo.ArticleSearchFilter;
import com.viettel.core.entities.vo.ArticleSearchVO;
 /**
   *  Mo ta muc dich cua lop (interface)
   *  @author: TOANTM1
   *  @version:  
   *  @since: 27/02/2014 - 11:34:02
   */
 public class ArticleMgrImpl implements ArticleMgr{ 
	@Autowired 
	ArticleDAO articleDAO; 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 11:34:02
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public Article getArticleById(Integer id) throws BusinessException { 
		try { 
			return  articleDAO.getArticleById(id); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 11:34:02
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public Article createArticle(Article article) throws BusinessException { 
		try { 
			return articleDAO.createArticle(article); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 11:34:02
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void updateArticle(Article article) throws BusinessException { 
		try { 
			articleDAO.updateArticle(article); 
		} catch (DataAccessException e) {	 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 11:34:02
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void deleteArticle(Article article) throws BusinessException { 
		try { 
			articleDAO.deleteArticle(article); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleSearchVO> getListArticleByFilter(
			ArticleSearchFilter filter) throws BusinessException {
		try { 
			return articleDAO.getListArticleByFilter(filter); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}
	
	@Override
	public List<ArticleSearchVO> getListArticleCategoryByFilter(
			ArticleSearchFilter filter) throws BusinessException {
		try { 
			return articleDAO.getListArticleCategoryByFilter(filter); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleRegimensSearchVO> getListSearchArticleAndRegimens(
			String content, KPaging<ArticleRegimensSearchVO> paging)
			throws BusinessException {
		try { 
			return articleDAO.getListSearchArticleAndRegimens(content, paging);
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
	
	@Override
	public List<Article> getListArticleByArticleCategory(Integer articleCategoryId) throws BusinessException {
		try { 
			return articleDAO.getListArticleByArticleCategory(articleCategoryId); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleSearchVO> getListArticleByArticleCategoryId(
			Integer articleCategoryId, Integer rowNum) throws BusinessException {
		try { 
			return articleDAO.getListArticleByArticleCategoryId(articleCategoryId, rowNum); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}
	@Override
	public List<Article> getListArticlesByArticleCategoryId(Integer id) throws BusinessException{
		try { 
			return articleDAO.getListArticlesByArticleCategoryId(id); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 	
	}
	
	public List<Article> getListArticlesByCmsUserId(Integer id) throws BusinessException{
		try { 
			return articleDAO.getListArticlesByCmsUserId(id); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 	
	}
	@Override
	public List<ArticleSearchVO> getListArticleById(Integer id)
			throws BusinessException{
		try { 
			return articleDAO.getListArticleById(id); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 	
	}
} 
